{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "TCResnet_KWS.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "id": "JobFn_J-v4fc"
      },
      "source": [
        "#!git clone https://github.com/hyperconnect/TC-ResNet.git\n",
        "#!pip3 install -r ./TC-ResNet/requirements/py36-gpu.txt"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "en6nnkKGxJmj"
      },
      "source": [
        "#cd TC-ResNet/"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "u7rv8HI8wCoB"
      },
      "source": [
        "# train model\n",
        "#! ./scripts/commands/TCResNet8Model-1.0_mfcc_40_3010_0.001_mom_l1.sh"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "p887-hwNwfPA",
        "outputId": "ddb58b0a-fb28-4130-b338-5abf47e0e2a1"
      },
      "source": [
        "!git clone https://github.com/tranHieuDev23/TC-ResNet.git"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Cloning into 'TC-ResNet'...\n",
            "remote: Enumerating objects: 21, done.\u001b[K\n",
            "remote: Counting objects: 100% (21/21), done.\u001b[K\n",
            "remote: Compressing objects: 100% (14/14), done.\u001b[K\n",
            "remote: Total 21 (delta 6), reused 20 (delta 5), pack-reused 0\u001b[K\n",
            "Unpacking objects: 100% (21/21), done.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "CgNgv3ykwmSt",
        "outputId": "976f5fec-1560-4a5e-aa1c-3762e253c2c9"
      },
      "source": [
        "cd TC-ResNet/"
      ],
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/TC-ResNet\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "mgWBf8eVWrqv"
      },
      "source": [
        "Uncomment following 5 cells to load google speech dataset"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "WBIYxaPuwwDm"
      },
      "source": [
        "#!mkdir dataset"
      ],
      "execution_count": 3,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "E4PC1Q-Iw26q"
      },
      "source": [
        "#cd dataset/"
      ],
      "execution_count": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "QrNN3pKMxot6"
      },
      "source": [
        "#!wget http://download.tensorflow.org/data/speech_commands_v0.01.tar.gz"
      ],
      "execution_count": 5,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "yLOPA0n0xsa6"
      },
      "source": [
        "#!tar xvf speech_commands_v0.01.tar.gz"
      ],
      "execution_count": 6,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "d7pv7aAxyGA9"
      },
      "source": [
        "#cd .."
      ],
      "execution_count": 7,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "nOF6kaUv1JdU"
      },
      "source": [
        "from os import listdir\n",
        "from os.path import join, isfile, isdir, normpath\n",
        "from multiprocessing import Pool, cpu_count\n",
        "from tqdm import tqdm\n",
        "import numpy as np\n",
        "from itertools import zip_longest\n",
        "import librosa\n",
        "import random\n",
        "import math\n",
        "import numpy as np\n",
        "from random import seed, randint\n",
        "from train import get_tc_resnet_8, get_tc_resnet_14\n",
        "from keras.optimizers import Adam\n",
        "from keras.callbacks import ModelCheckpoint\n",
        "from keras.models import Model, Sequential\n",
        "from keras.layers import Input, Conv1D, ReLU, BatchNormalization, Add, AveragePooling1D, Dense, Flatten, Dropout, Activation\n",
        "from google.colab import files\n"
      ],
      "execution_count": 8,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "tJEb-wNqyZaV",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 188
        },
        "outputId": "ddd80d03-8844-4d86-c12c-7bc828cd425f"
      },
      "source": [
        "# To train entire tc-resnet--uncomment\n",
        "\"\"\"\n",
        "from process_data import process_file, generate_noisy_sample\n",
        "def __load_audio_filenames_with_class__(root_folder):\n",
        "    classes = [item for item in listdir(root_folder) if isdir(\n",
        "        join(root_folder, item)) and not item.startswith('_')]\n",
        "    filenames = []\n",
        "    class_ids = []\n",
        "    for i in range(len(classes)):\n",
        "        c = classes[i]\n",
        "        class_filenames = __load_audio_filenames__(join(root_folder, c))\n",
        "        filenames.extend(class_filenames)\n",
        "        class_ids.extend([i] * len(class_filenames))\n",
        "    return filenames, class_ids, classes\n",
        "\n",
        "\n",
        "def __load_audio_filenames__(root_folder):\n",
        "    filenames = []\n",
        "    for entry in listdir(root_folder):\n",
        "        full_path = join(root_folder, entry)\n",
        "        if (isfile(full_path)):\n",
        "            if (entry.endswith('.wav')):\n",
        "                filenames.append(full_path)\n",
        "        else:\n",
        "            filenames.extend(__load_audio_filenames__(full_path))\n",
        "        if (len(filenames) >= 100):\n",
        "            break\n",
        "    return filenames\n",
        "\n",
        "\n",
        "def __load_subset_filenames__(root_folder, filename):\n",
        "    subset_list = []\n",
        "    with open(join(root_folder, filename)) as f:\n",
        "        for line in f:\n",
        "            line = line.strip()\n",
        "            if (len(line) == 0):\n",
        "                continue\n",
        "            subset_list.append(normpath(join(root_folder, line)))\n",
        "    return set(subset_list)\n",
        "\n",
        "\n",
        "def load_data_from_folder(root_folder):\n",
        "    filenames, class_ids, classes = __load_audio_filenames_with_class__(root_folder)\n",
        "    dataset_size = len(filenames)\n",
        "    X_train = []\n",
        "    y_train = []\n",
        "    X_test = []\n",
        "    y_test = []\n",
        "    X_validation = []\n",
        "    y_validation = []\n",
        "    pool = Pool(cpu_count() - 1)\n",
        "    for (results, filepath, class_id, random_roll) in tqdm(pool.imap_unordered(process_file, zip_longest(filenames, class_ids)), total=dataset_size):\n",
        "        filepath = normpath(filepath)\n",
        "        is_testing = 1 <= random_roll and random_roll <= 10\n",
        "        is_validation = 11 <= random_roll and random_roll <= 20\n",
        "        for item in results:\n",
        "            if (is_testing):\n",
        "                X_test.append(item)\n",
        "                y_test.append(class_id)\n",
        "            elif (is_validation):\n",
        "                X_validation.append(item)\n",
        "                y_validation.append(class_id)\n",
        "            else:\n",
        "                X_train.append(item)\n",
        "                y_train.append(class_id)\n",
        "    X_train = np.array(X_train)\n",
        "    y_train = np.array(y_train)\n",
        "    X_test = np.array(X_test)\n",
        "    y_test = np.array(y_test)\n",
        "    X_validation = np.array(X_validation)\n",
        "    y_validation = np.array(y_validation)\n",
        "    return X_train, y_train, X_test, y_test, X_validation, y_validation, classes\n",
        "\n",
        "X_train, y_train, X_test, y_test, X_validation, y_validation, classes = load_data_from_folder('dataset')\n",
        "num_classes = len(classes)\n",
        "print(num_classes)\n",
        "(num_train, input_length, num_channel) = X_train.shape\n",
        "num_test = X_test.shape[0]\n",
        "num_validation = X_validation.shape[0]\n",
        "model_14 = get_tc_resnet_8((input_length, num_channel), num_classes, 1.5)\n",
        "model_14.compile(optimizer=Adam(),loss='sparse_categorical_crossentropy', metrics=['accuracy'])\n",
        "#checkpoint_cb = ModelCheckpoint('weights.{epoch:02d}-{val_loss:.2f}.h5', save_weights_only=True, period=5)\n",
        "model_14.fit(x=X_train, y=y_train, batch_size=1024, epochs=100, validation_data=(X_test, y_test))#, callbacks=[checkpoint_cb])\n",
        "print(model_14.evaluate(X_validation, y_validation))\n",
        "model_14.save_weights('weights.h5')\n",
        "files.download('weights.h5') \n",
        "\"\"\""
      ],
      "execution_count": 9,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "type": "string"
            },
            "text/plain": [
              "\"\\nfrom process_data import process_file, generate_noisy_sample\\ndef __load_audio_filenames_with_class__(root_folder):\\n    classes = [item for item in listdir(root_folder) if isdir(\\n        join(root_folder, item)) and not item.startswith('_')]\\n    filenames = []\\n    class_ids = []\\n    for i in range(len(classes)):\\n        c = classes[i]\\n        class_filenames = __load_audio_filenames__(join(root_folder, c))\\n        filenames.extend(class_filenames)\\n        class_ids.extend([i] * len(class_filenames))\\n    return filenames, class_ids, classes\\n\\n\\ndef __load_audio_filenames__(root_folder):\\n    filenames = []\\n    for entry in listdir(root_folder):\\n        full_path = join(root_folder, entry)\\n        if (isfile(full_path)):\\n            if (entry.endswith('.wav')):\\n                filenames.append(full_path)\\n        else:\\n            filenames.extend(__load_audio_filenames__(full_path))\\n        if (len(filenames) >= 100):\\n            break\\n    return filenames\\n\\n\\ndef __load_subset_filenames__(root_folder, filename):\\n    subset_list = []\\n    with open(join(root_folder, filename)) as f:\\n        for line in f:\\n            line = line.strip()\\n            if (len(line) == 0):\\n                continue\\n            subset_list.append(normpath(join(root_folder, line)))\\n    return set(subset_list)\\n\\n\\ndef load_data_from_folder(root_folder):\\n    filenames, class_ids, classes = __load_audio_filenames_with_class__(root_folder)\\n    dataset_size = len(filenames)\\n    X_train = []\\n    y_train = []\\n    X_test = []\\n    y_test = []\\n    X_validation = []\\n    y_validation = []\\n    pool = Pool(cpu_count() - 1)\\n    for (results, filepath, class_id, random_roll) in tqdm(pool.imap_unordered(process_file, zip_longest(filenames, class_ids)), total=dataset_size):\\n        filepath = normpath(filepath)\\n        is_testing = 1 <= random_roll and random_roll <= 10\\n        is_validation = 11 <= random_roll and random_roll <= 20\\n        for item in results:\\n            if (is_testing):\\n                X_test.append(item)\\n                y_test.append(class_id)\\n            elif (is_validation):\\n                X_validation.append(item)\\n                y_validation.append(class_id)\\n            else:\\n                X_train.append(item)\\n                y_train.append(class_id)\\n    X_train = np.array(X_train)\\n    y_train = np.array(y_train)\\n    X_test = np.array(X_test)\\n    y_test = np.array(y_test)\\n    X_validation = np.array(X_validation)\\n    y_validation = np.array(y_validation)\\n    return X_train, y_train, X_test, y_test, X_validation, y_validation, classes\\n\\nX_train, y_train, X_test, y_test, X_validation, y_validation, classes = load_data_from_folder('dataset')\\nnum_classes = len(classes)\\nprint(num_classes)\\n(num_train, input_length, num_channel) = X_train.shape\\nnum_test = X_test.shape[0]\\nnum_validation = X_validation.shape[0]\\nmodel_14 = get_tc_resnet_8((input_length, num_channel), num_classes, 1.5)\\nmodel_14.compile(optimizer=Adam(),loss='sparse_categorical_crossentropy', metrics=['accuracy'])\\n#checkpoint_cb = ModelCheckpoint('weights.{epoch:02d}-{val_loss:.2f}.h5', save_weights_only=True, period=5)\\nmodel_14.fit(x=X_train, y=y_train, batch_size=1024, epochs=100, validation_data=(X_test, y_test))#, callbacks=[checkpoint_cb])\\nprint(model_14.evaluate(X_validation, y_validation))\\nmodel_14.save_weights('weights.h5')\\nfiles.download('weights.h5') \\n\""
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 9
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "8xWaQbus393f",
        "outputId": "0483f7fb-ad1c-4174-faa8-d608f97a3902"
      },
      "source": [
        "# Make a bottle neck model\n",
        "\n",
        "original_model    = get_tc_resnet_8((321, 40), 30, 1.5) #model corresponding to kws on google speech cmds: input length, num_channel, num_classes\n",
        "original_model.load_weights('weights.h5') #Assuming this file is loaded in the current working dir\n",
        "bottleneck_input  = original_model.get_layer(index=0).input\n",
        "print(bottleneck_input)\n",
        "bottleneck_output = original_model.get_layer(index=-2).output\n",
        "print(bottleneck_output)\n",
        "bottleneck_model  = Model(inputs=bottleneck_input,outputs=bottleneck_output)"
      ],
      "execution_count": 11,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "KerasTensor(type_spec=TensorSpec(shape=(None, 321, 40), dtype=tf.float32, name='input_2'), name='input_2', description=\"created by layer 'input_2'\")\n",
            "KerasTensor(type_spec=TensorSpec(shape=(None, 2808), dtype=tf.float32, name=None), name='dropout_1/Identity:0', description=\"created by layer 'dropout_1'\")\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "4bHfhslo4Q2W"
      },
      "source": [
        "# Add the last softmax layer\n",
        "for layer in bottleneck_model.layers:\n",
        "    layer.trainable = False\n",
        "\n",
        "new_model = Sequential()\n",
        "new_model.add(bottleneck_model)\n",
        "kws_classes = 101\n",
        "new_model.add(Dense(kws_classes, activation=\"softmax\", input_dim=2808))"
      ],
      "execution_count": 12,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "8Lv5FcY0TVGC"
      },
      "source": [
        "Following 5 cells to load the Competition dataset (train)"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "S1RHKaVe-hlO"
      },
      "source": [
        "!mkdir dataset1"
      ],
      "execution_count": 13,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "2k3G3hLn-7Yb",
        "outputId": "14bbf4cb-9549-433e-851b-faf51791fed6"
      },
      "source": [
        "cd dataset1/"
      ],
      "execution_count": 14,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/TC-ResNet/dataset1\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "17O3NOZx_FRX",
        "outputId": "a86c5c01-a1f3-4ade-d24b-fe1ab2daa1ee"
      },
      "source": [
        "!gdown --id 1w4Bn038sLxuv9PKswk2KorCUmgPNup3c"
      ],
      "execution_count": 15,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Downloading...\n",
            "From: https://drive.google.com/uc?id=1w4Bn038sLxuv9PKswk2KorCUmgPNup3c\n",
            "To: /content/TC-ResNet/dataset1/train.zip\n",
            "211MB [00:01, 189MB/s]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "VFNbngU5_x-1"
      },
      "source": [
        "!unzip train.zip"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "NBi7j2RMAAYX",
        "outputId": "258884cf-c3f5-4b10-deb2-b5b1238df061"
      },
      "source": [
        "cd .."
      ],
      "execution_count": 17,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/TC-ResNet\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "aCe-0RFEajYG"
      },
      "source": [
        "Load the _background_noise folder in dataset1/train\n"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "OOuXVVmOZs3x"
      },
      "source": [
        "\n",
        "AUDIO_LENGTH = 2\n",
        "\n",
        "seed(163)\n",
        "\n",
        "\n",
        "def __load_background_noises__(root_folder):\n",
        "    noises = []\n",
        "    noise_folder = join(root_folder, '_background_noise_')\n",
        "    for item in listdir(noise_folder):\n",
        "        if (not item.endswith('.wav')):\n",
        "            continue\n",
        "        samples, sr = librosa.load(join(noise_folder, item), sr=None)\n",
        "        noises.append(samples)\n",
        "    return noises\n",
        "\n",
        "\n",
        "noises = __load_background_noises__('')\n",
        "\n",
        "\n",
        "def generate_noisy_sample(samples, noise):\n",
        "    samples_length = len(samples)\n",
        "    noise_length = len(noise)\n",
        "    if (noise_length < samples_length):\n",
        "        return samples\n",
        "    noise_start = random.randint(0, noise_length - samples_length - 1)\n",
        "    noise_part = noise[noise_start:noise_start + samples_length]\n",
        "    noise_coeff = random.uniform(0.0, 0.1)\n",
        "    audio_offset = math.floor(\n",
        "        random.uniform(-samples_length * 0.1, samples_length * 0.1))\n",
        "    new_samples = np.zeros((samples_length))\n",
        "    if (audio_offset >= 0):\n",
        "        new_samples[audio_offset:] = samples[:samples_length - audio_offset]\n",
        "    else:\n",
        "        new_samples[:samples_length + audio_offset] = samples[-audio_offset:]\n",
        "    new_samples = noise_part * noise_coeff + \\\n",
        "        (1.0 - noise_coeff) * new_samples\n",
        "    return new_samples\n",
        "\n",
        "\n",
        "def get_mfcc(samples, sr):\n",
        "    return librosa.feature.mfcc(samples, sr=sr, n_mfcc=40, n_fft=400, hop_length=100).transpose()\n",
        "\n",
        "\n",
        "def process_file(argv):\n",
        "    (filepath, class_id) = argv\n",
        "    results = []\n",
        "    samples, sr = librosa.load(filepath, sr=None)\n",
        "    samples_len = len(samples)\n",
        "    if (samples_len > sr * AUDIO_LENGTH):\n",
        "        samples = samples[- sr * AUDIO_LENGTH:]\n",
        "    elif (samples_len < sr * AUDIO_LENGTH):\n",
        "        temp = np.zeros((sr * AUDIO_LENGTH))\n",
        "        temp[:samples_len] = samples\n",
        "        samples = temp\n",
        "    mfcc = get_mfcc(samples, sr)\n",
        "    results.append(mfcc)\n",
        "    random_roll = randint(1, 100)\n",
        "    is_testing = 1 <= random_roll and random_roll <= 10\n",
        "    is_validation = 11 <= random_roll and random_roll <= 20\n",
        "    if (not is_testing and not is_validation):\n",
        "        for item in noises:\n",
        "            new_samples = generate_noisy_sample(samples, item)\n",
        "            mfcc = get_mfcc(new_samples, sr)\n",
        "            results.append(mfcc)\n",
        "    return results, filepath, class_id, random_roll\n"
      ],
      "execution_count": 18,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "bWWWSn_G6SOs",
        "outputId": "2faa5cca-5ee3-44d0-a8cc-feb7d8bf570c"
      },
      "source": [
        "def __load_new_audio_filenames_with_class__(root_folder):\n",
        "    classes = [item for item in listdir(root_folder) if item.startswith('T')] #classes as \"T00xx\"\n",
        "    classes.sort()\n",
        "    classes.append('others')\n",
        "    filenames = []\n",
        "    class_ids = []\n",
        "    for i in range(len(classes)-1):\n",
        "        c = classes[i] \n",
        "        class_filenames = __load_new_audio_filenames__((join(root_folder, c, \"enrollment\"))) #location of wav files for kws\n",
        "        filenames.extend(class_filenames)\n",
        "        class_ids.extend([i] * len(class_filenames))\n",
        "        class_filenames = __load_new_audio_filenames__((join(root_folder, c, \"others\"))) #location of wav files for kws\n",
        "        filenames.extend(class_filenames)\n",
        "        class_ids.extend([len(classes)-1] * len(class_filenames))        \n",
        "    return filenames, class_ids, classes\n",
        "\n",
        "\n",
        "def __load_new_audio_filenames__(root_folder):\n",
        "    filenames = []\n",
        "    for entry in listdir(root_folder):\n",
        "        full_path = join(root_folder, entry)\n",
        "        if (isfile(full_path)):\n",
        "            if (entry.endswith('.wav')):\n",
        "                filenames.append(full_path)\n",
        "        else:\n",
        "            filenames.extend(__load_audio_filenames__(full_path))\n",
        "        #if (len(filenames) >= 10):\n",
        "            #break\n",
        "    return filenames\n",
        "\n",
        "def load_new_data_from_folder(root_folder):\n",
        "    filenames, class_ids, classes = __load_new_audio_filenames_with_class__(root_folder)\n",
        "    dataset_size = len(filenames)\n",
        "    X_train = []\n",
        "    y_train = []\n",
        "    X_test = []\n",
        "    y_test = []\n",
        "    X_validation = []\n",
        "    y_validation = []\n",
        "    pool = Pool(cpu_count() - 1)\n",
        "    for (results, filepath, class_id, random_roll) in tqdm(pool.imap_unordered(process_file, zip_longest(filenames, class_ids)), total=dataset_size):\n",
        "        filepath = normpath(filepath)\n",
        "        is_testing = 1 <= random_roll and random_roll <= 10 #vary these to modify train-val-test lengths\n",
        "        is_validation = 11 <= random_roll and random_roll <=20\n",
        "        for item in results:\n",
        "            if (is_testing):\n",
        "                X_test.append(item)\n",
        "                y_test.append(class_id)\n",
        "            elif (is_validation):\n",
        "                X_validation.append(item)\n",
        "                y_validation.append(class_id)\n",
        "                X_test.append(item)\n",
        "                y_test.append(class_id)\n",
        "            else:\n",
        "                X_train.append(item)\n",
        "                y_train.append(class_id)\n",
        "    X_train = np.array(X_train)\n",
        "    y_train = np.array(y_train)\n",
        "    X_test = np.array(X_test)\n",
        "    y_test = np.array(y_test)\n",
        "    X_validation = np.array(X_validation)\n",
        "    y_validation = np.array(y_validation)\n",
        "    return X_train, y_train, X_test, y_test, X_validation, y_validation, classes\n",
        "\n",
        "X_train, y_train, X_test, y_test, X_validation, y_validation, classes = load_new_data_from_folder('dataset1/train')\n",
        "num_classes = len(classes)\n",
        "(num_train, input_length, num_channel) = X_train.shape\n",
        "num_test = X_test.shape[0]\n",
        "num_validation = X_validation.shape[0]\n",
        "print(num_classes)\n",
        "print(num_train)\n",
        "print(num_test)\n",
        "print(num_validation)\n"
      ],
      "execution_count": 19,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "100%|██████████| 3000/3000 [02:52<00:00, 17.42it/s]\n"
          ],
          "name": "stderr"
        },
        {
          "output_type": "stream",
          "text": [
            "101\n",
            "17129\n",
            "553\n",
            "288\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "9sZNkUj-7P-s",
        "outputId": "917f1f59-49d4-48ea-fee4-938c721933ec"
      },
      "source": [
        "new_model.compile(optimizer=Adam(),loss='sparse_categorical_crossentropy', metrics=['accuracy'])\n",
        "new_model.fit(x=X_train, y=y_train, batch_size=512, epochs=500, validation_data=(X_test, y_test))\n",
        "print(new_model.evaluate(X_validation, y_validation))\n",
        "new_model.save_weights('new_weights.h5')"
      ],
      "execution_count": 20,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0264 - accuracy: 0.9925 - val_loss: 0.9405 - val_accuracy: 0.8987\n",
            "Epoch 143/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0282 - accuracy: 0.9904 - val_loss: 0.9019 - val_accuracy: 0.8933\n",
            "Epoch 144/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0293 - accuracy: 0.9914 - val_loss: 0.9240 - val_accuracy: 0.8933\n",
            "Epoch 145/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0267 - accuracy: 0.9910 - val_loss: 0.9098 - val_accuracy: 0.9024\n",
            "Epoch 146/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0285 - accuracy: 0.9918 - val_loss: 0.9429 - val_accuracy: 0.9005\n",
            "Epoch 147/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0324 - accuracy: 0.9892 - val_loss: 0.9248 - val_accuracy: 0.8969\n",
            "Epoch 148/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0292 - accuracy: 0.9906 - val_loss: 0.9566 - val_accuracy: 0.8879\n",
            "Epoch 149/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0289 - accuracy: 0.9909 - val_loss: 0.9417 - val_accuracy: 0.8987\n",
            "Epoch 150/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0268 - accuracy: 0.9910 - val_loss: 1.0386 - val_accuracy: 0.8933\n",
            "Epoch 151/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0269 - accuracy: 0.9907 - val_loss: 0.9299 - val_accuracy: 0.9005\n",
            "Epoch 152/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0254 - accuracy: 0.9910 - val_loss: 1.0241 - val_accuracy: 0.8897\n",
            "Epoch 153/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0288 - accuracy: 0.9899 - val_loss: 0.9610 - val_accuracy: 0.8987\n",
            "Epoch 154/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0262 - accuracy: 0.9909 - val_loss: 1.0343 - val_accuracy: 0.8987\n",
            "Epoch 155/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0258 - accuracy: 0.9932 - val_loss: 0.9793 - val_accuracy: 0.8969\n",
            "Epoch 156/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0234 - accuracy: 0.9939 - val_loss: 1.0173 - val_accuracy: 0.8969\n",
            "Epoch 157/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0307 - accuracy: 0.9897 - val_loss: 0.9905 - val_accuracy: 0.9042\n",
            "Epoch 158/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0262 - accuracy: 0.9909 - val_loss: 1.0230 - val_accuracy: 0.8969\n",
            "Epoch 159/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0297 - accuracy: 0.9907 - val_loss: 1.0377 - val_accuracy: 0.8969\n",
            "Epoch 160/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0269 - accuracy: 0.9909 - val_loss: 0.9636 - val_accuracy: 0.9060\n",
            "Epoch 161/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0273 - accuracy: 0.9910 - val_loss: 1.0770 - val_accuracy: 0.8987\n",
            "Epoch 162/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0246 - accuracy: 0.9930 - val_loss: 0.9850 - val_accuracy: 0.8987\n",
            "Epoch 163/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0275 - accuracy: 0.9917 - val_loss: 0.9761 - val_accuracy: 0.9042\n",
            "Epoch 164/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0266 - accuracy: 0.9903 - val_loss: 1.0982 - val_accuracy: 0.8897\n",
            "Epoch 165/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0310 - accuracy: 0.9904 - val_loss: 1.1263 - val_accuracy: 0.8987\n",
            "Epoch 166/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0312 - accuracy: 0.9911 - val_loss: 1.0579 - val_accuracy: 0.9060\n",
            "Epoch 167/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0235 - accuracy: 0.9926 - val_loss: 1.0249 - val_accuracy: 0.9024\n",
            "Epoch 168/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0321 - accuracy: 0.9894 - val_loss: 1.0224 - val_accuracy: 0.8969\n",
            "Epoch 169/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0252 - accuracy: 0.9917 - val_loss: 1.0574 - val_accuracy: 0.9005\n",
            "Epoch 170/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0355 - accuracy: 0.9885 - val_loss: 1.0881 - val_accuracy: 0.8969\n",
            "Epoch 171/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0275 - accuracy: 0.9911 - val_loss: 1.0648 - val_accuracy: 0.8987\n",
            "Epoch 172/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0306 - accuracy: 0.9905 - val_loss: 1.1280 - val_accuracy: 0.8879\n",
            "Epoch 173/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0247 - accuracy: 0.9911 - val_loss: 1.1031 - val_accuracy: 0.8861\n",
            "Epoch 174/500\n",
            "34/34 [==============================] - 1s 22ms/step - loss: 0.0264 - accuracy: 0.9912 - val_loss: 1.1018 - val_accuracy: 0.8897\n",
            "Epoch 175/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0287 - accuracy: 0.9904 - val_loss: 1.1014 - val_accuracy: 0.9005\n",
            "Epoch 176/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0249 - accuracy: 0.9923 - val_loss: 1.0793 - val_accuracy: 0.8933\n",
            "Epoch 177/500\n",
            "34/34 [==============================] - 1s 22ms/step - loss: 0.0242 - accuracy: 0.9918 - val_loss: 1.0519 - val_accuracy: 0.8951\n",
            "Epoch 178/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0254 - accuracy: 0.9919 - val_loss: 1.1482 - val_accuracy: 0.8951\n",
            "Epoch 179/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0247 - accuracy: 0.9915 - val_loss: 1.1395 - val_accuracy: 0.8861\n",
            "Epoch 180/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0318 - accuracy: 0.9891 - val_loss: 1.1378 - val_accuracy: 0.8825\n",
            "Epoch 181/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0244 - accuracy: 0.9911 - val_loss: 1.1339 - val_accuracy: 0.8933\n",
            "Epoch 182/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0268 - accuracy: 0.9920 - val_loss: 1.1141 - val_accuracy: 0.8951\n",
            "Epoch 183/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0268 - accuracy: 0.9922 - val_loss: 1.0552 - val_accuracy: 0.9005\n",
            "Epoch 184/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0296 - accuracy: 0.9908 - val_loss: 1.1167 - val_accuracy: 0.8987\n",
            "Epoch 185/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0275 - accuracy: 0.9909 - val_loss: 1.1463 - val_accuracy: 0.9024\n",
            "Epoch 186/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0257 - accuracy: 0.9914 - val_loss: 1.1427 - val_accuracy: 0.8951\n",
            "Epoch 187/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0307 - accuracy: 0.9913 - val_loss: 1.2175 - val_accuracy: 0.8951\n",
            "Epoch 188/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0244 - accuracy: 0.9920 - val_loss: 1.1618 - val_accuracy: 0.8897\n",
            "Epoch 189/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0280 - accuracy: 0.9913 - val_loss: 1.0718 - val_accuracy: 0.8987\n",
            "Epoch 190/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0284 - accuracy: 0.9924 - val_loss: 1.1079 - val_accuracy: 0.8951\n",
            "Epoch 191/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0262 - accuracy: 0.9926 - val_loss: 1.1646 - val_accuracy: 0.8915\n",
            "Epoch 192/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0245 - accuracy: 0.9922 - val_loss: 1.1765 - val_accuracy: 0.8915\n",
            "Epoch 193/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0254 - accuracy: 0.9913 - val_loss: 1.1211 - val_accuracy: 0.8951\n",
            "Epoch 194/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0232 - accuracy: 0.9918 - val_loss: 1.0750 - val_accuracy: 0.8987\n",
            "Epoch 195/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0241 - accuracy: 0.9920 - val_loss: 1.0691 - val_accuracy: 0.8933\n",
            "Epoch 196/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0256 - accuracy: 0.9915 - val_loss: 1.1863 - val_accuracy: 0.8879\n",
            "Epoch 197/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0263 - accuracy: 0.9912 - val_loss: 1.1137 - val_accuracy: 0.8951\n",
            "Epoch 198/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0271 - accuracy: 0.9908 - val_loss: 1.0915 - val_accuracy: 0.9005\n",
            "Epoch 199/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0265 - accuracy: 0.9917 - val_loss: 1.1136 - val_accuracy: 0.8969\n",
            "Epoch 200/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0290 - accuracy: 0.9920 - val_loss: 1.0457 - val_accuracy: 0.8969\n",
            "Epoch 201/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0294 - accuracy: 0.9923 - val_loss: 1.1669 - val_accuracy: 0.8951\n",
            "Epoch 202/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0255 - accuracy: 0.9917 - val_loss: 1.1057 - val_accuracy: 0.8915\n",
            "Epoch 203/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0314 - accuracy: 0.9904 - val_loss: 1.0946 - val_accuracy: 0.9042\n",
            "Epoch 204/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0290 - accuracy: 0.9919 - val_loss: 1.1538 - val_accuracy: 0.8987\n",
            "Epoch 205/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0263 - accuracy: 0.9915 - val_loss: 1.1071 - val_accuracy: 0.9005\n",
            "Epoch 206/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0216 - accuracy: 0.9924 - val_loss: 1.1045 - val_accuracy: 0.8915\n",
            "Epoch 207/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0227 - accuracy: 0.9923 - val_loss: 1.1412 - val_accuracy: 0.8861\n",
            "Epoch 208/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0237 - accuracy: 0.9923 - val_loss: 1.1224 - val_accuracy: 0.8987\n",
            "Epoch 209/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0279 - accuracy: 0.9910 - val_loss: 1.1700 - val_accuracy: 0.9005\n",
            "Epoch 210/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0230 - accuracy: 0.9931 - val_loss: 1.1486 - val_accuracy: 0.8951\n",
            "Epoch 211/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0237 - accuracy: 0.9920 - val_loss: 1.1062 - val_accuracy: 0.8933\n",
            "Epoch 212/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0269 - accuracy: 0.9915 - val_loss: 1.0908 - val_accuracy: 0.9005\n",
            "Epoch 213/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0248 - accuracy: 0.9921 - val_loss: 1.0635 - val_accuracy: 0.9024\n",
            "Epoch 214/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0282 - accuracy: 0.9917 - val_loss: 1.0523 - val_accuracy: 0.9024\n",
            "Epoch 215/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0321 - accuracy: 0.9908 - val_loss: 1.1844 - val_accuracy: 0.8951\n",
            "Epoch 216/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0212 - accuracy: 0.9927 - val_loss: 1.1071 - val_accuracy: 0.8951\n",
            "Epoch 217/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0328 - accuracy: 0.9904 - val_loss: 1.1338 - val_accuracy: 0.9042\n",
            "Epoch 218/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0249 - accuracy: 0.9920 - val_loss: 1.1220 - val_accuracy: 0.9005\n",
            "Epoch 219/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0237 - accuracy: 0.9926 - val_loss: 1.1689 - val_accuracy: 0.8951\n",
            "Epoch 220/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0200 - accuracy: 0.9928 - val_loss: 1.1565 - val_accuracy: 0.8951\n",
            "Epoch 221/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0245 - accuracy: 0.9924 - val_loss: 1.2390 - val_accuracy: 0.8933\n",
            "Epoch 222/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0282 - accuracy: 0.9916 - val_loss: 1.1322 - val_accuracy: 0.8933\n",
            "Epoch 223/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0305 - accuracy: 0.9908 - val_loss: 1.1702 - val_accuracy: 0.8969\n",
            "Epoch 224/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0233 - accuracy: 0.9925 - val_loss: 1.1096 - val_accuracy: 0.8951\n",
            "Epoch 225/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0253 - accuracy: 0.9907 - val_loss: 1.1337 - val_accuracy: 0.8915\n",
            "Epoch 226/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0278 - accuracy: 0.9912 - val_loss: 1.1595 - val_accuracy: 0.8933\n",
            "Epoch 227/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0235 - accuracy: 0.9915 - val_loss: 1.1186 - val_accuracy: 0.8951\n",
            "Epoch 228/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0208 - accuracy: 0.9931 - val_loss: 1.1844 - val_accuracy: 0.8861\n",
            "Epoch 229/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0256 - accuracy: 0.9907 - val_loss: 1.2234 - val_accuracy: 0.8879\n",
            "Epoch 230/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0219 - accuracy: 0.9922 - val_loss: 1.1998 - val_accuracy: 0.8933\n",
            "Epoch 231/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0242 - accuracy: 0.9913 - val_loss: 1.1504 - val_accuracy: 0.8969\n",
            "Epoch 232/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0271 - accuracy: 0.9914 - val_loss: 1.1162 - val_accuracy: 0.8987\n",
            "Epoch 233/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0259 - accuracy: 0.9925 - val_loss: 1.2645 - val_accuracy: 0.8807\n",
            "Epoch 234/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0248 - accuracy: 0.9928 - val_loss: 1.2106 - val_accuracy: 0.8933\n",
            "Epoch 235/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0307 - accuracy: 0.9919 - val_loss: 1.1057 - val_accuracy: 0.8969\n",
            "Epoch 236/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0236 - accuracy: 0.9922 - val_loss: 1.2296 - val_accuracy: 0.8915\n",
            "Epoch 237/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0311 - accuracy: 0.9903 - val_loss: 1.1518 - val_accuracy: 0.8951\n",
            "Epoch 238/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0303 - accuracy: 0.9906 - val_loss: 1.2781 - val_accuracy: 0.8861\n",
            "Epoch 239/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0241 - accuracy: 0.9928 - val_loss: 1.2363 - val_accuracy: 0.8915\n",
            "Epoch 240/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0254 - accuracy: 0.9922 - val_loss: 1.2345 - val_accuracy: 0.8933\n",
            "Epoch 241/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0254 - accuracy: 0.9911 - val_loss: 1.1474 - val_accuracy: 0.9005\n",
            "Epoch 242/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0229 - accuracy: 0.9930 - val_loss: 1.2074 - val_accuracy: 0.8969\n",
            "Epoch 243/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0228 - accuracy: 0.9921 - val_loss: 1.1544 - val_accuracy: 0.8933\n",
            "Epoch 244/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0191 - accuracy: 0.9937 - val_loss: 1.1337 - val_accuracy: 0.8987\n",
            "Epoch 245/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0243 - accuracy: 0.9920 - val_loss: 1.2144 - val_accuracy: 0.8861\n",
            "Epoch 246/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0215 - accuracy: 0.9935 - val_loss: 1.1590 - val_accuracy: 0.8987\n",
            "Epoch 247/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0221 - accuracy: 0.9934 - val_loss: 1.1340 - val_accuracy: 0.8915\n",
            "Epoch 248/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0314 - accuracy: 0.9905 - val_loss: 1.1248 - val_accuracy: 0.9042\n",
            "Epoch 249/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0248 - accuracy: 0.9922 - val_loss: 1.1394 - val_accuracy: 0.9114\n",
            "Epoch 250/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0226 - accuracy: 0.9921 - val_loss: 1.2797 - val_accuracy: 0.8879\n",
            "Epoch 251/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0292 - accuracy: 0.9904 - val_loss: 1.2022 - val_accuracy: 0.9078\n",
            "Epoch 252/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0272 - accuracy: 0.9912 - val_loss: 1.2280 - val_accuracy: 0.8897\n",
            "Epoch 253/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0213 - accuracy: 0.9936 - val_loss: 1.1674 - val_accuracy: 0.8987\n",
            "Epoch 254/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0261 - accuracy: 0.9900 - val_loss: 1.1533 - val_accuracy: 0.9078\n",
            "Epoch 255/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0223 - accuracy: 0.9930 - val_loss: 1.1803 - val_accuracy: 0.9024\n",
            "Epoch 256/500\n",
            "34/34 [==============================] - 1s 26ms/step - loss: 0.0228 - accuracy: 0.9915 - val_loss: 1.3284 - val_accuracy: 0.8897\n",
            "Epoch 257/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0263 - accuracy: 0.9917 - val_loss: 1.2274 - val_accuracy: 0.9005\n",
            "Epoch 258/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0258 - accuracy: 0.9932 - val_loss: 1.1984 - val_accuracy: 0.8969\n",
            "Epoch 259/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0225 - accuracy: 0.9924 - val_loss: 1.2740 - val_accuracy: 0.8951\n",
            "Epoch 260/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0188 - accuracy: 0.9933 - val_loss: 1.2818 - val_accuracy: 0.8897\n",
            "Epoch 261/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0272 - accuracy: 0.9909 - val_loss: 1.1655 - val_accuracy: 0.8987\n",
            "Epoch 262/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0280 - accuracy: 0.9929 - val_loss: 1.1990 - val_accuracy: 0.8951\n",
            "Epoch 263/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0271 - accuracy: 0.9920 - val_loss: 1.2128 - val_accuracy: 0.8915\n",
            "Epoch 264/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0256 - accuracy: 0.9925 - val_loss: 1.3007 - val_accuracy: 0.8951\n",
            "Epoch 265/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0255 - accuracy: 0.9930 - val_loss: 1.2987 - val_accuracy: 0.8987\n",
            "Epoch 266/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0287 - accuracy: 0.9920 - val_loss: 1.2254 - val_accuracy: 0.8933\n",
            "Epoch 267/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0239 - accuracy: 0.9924 - val_loss: 1.2747 - val_accuracy: 0.8915\n",
            "Epoch 268/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0286 - accuracy: 0.9909 - val_loss: 1.2800 - val_accuracy: 0.9042\n",
            "Epoch 269/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0212 - accuracy: 0.9931 - val_loss: 1.2641 - val_accuracy: 0.8987\n",
            "Epoch 270/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0252 - accuracy: 0.9921 - val_loss: 1.2706 - val_accuracy: 0.9042\n",
            "Epoch 271/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0285 - accuracy: 0.9913 - val_loss: 1.2854 - val_accuracy: 0.9005\n",
            "Epoch 272/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0301 - accuracy: 0.9913 - val_loss: 1.1499 - val_accuracy: 0.9024\n",
            "Epoch 273/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0187 - accuracy: 0.9935 - val_loss: 1.4145 - val_accuracy: 0.8951\n",
            "Epoch 274/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0222 - accuracy: 0.9921 - val_loss: 1.2822 - val_accuracy: 0.8951\n",
            "Epoch 275/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0204 - accuracy: 0.9937 - val_loss: 1.2624 - val_accuracy: 0.8969\n",
            "Epoch 276/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0254 - accuracy: 0.9921 - val_loss: 1.1640 - val_accuracy: 0.9005\n",
            "Epoch 277/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0271 - accuracy: 0.9914 - val_loss: 1.2851 - val_accuracy: 0.8969\n",
            "Epoch 278/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0193 - accuracy: 0.9925 - val_loss: 1.2455 - val_accuracy: 0.9024\n",
            "Epoch 279/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0278 - accuracy: 0.9919 - val_loss: 1.2868 - val_accuracy: 0.8933\n",
            "Epoch 280/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0232 - accuracy: 0.9915 - val_loss: 1.2460 - val_accuracy: 0.8969\n",
            "Epoch 281/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0259 - accuracy: 0.9917 - val_loss: 1.3174 - val_accuracy: 0.8951\n",
            "Epoch 282/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0276 - accuracy: 0.9918 - val_loss: 1.3527 - val_accuracy: 0.8987\n",
            "Epoch 283/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0264 - accuracy: 0.9923 - val_loss: 1.2851 - val_accuracy: 0.8969\n",
            "Epoch 284/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0260 - accuracy: 0.9912 - val_loss: 1.3462 - val_accuracy: 0.9005\n",
            "Epoch 285/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0266 - accuracy: 0.9921 - val_loss: 1.3231 - val_accuracy: 0.9042\n",
            "Epoch 286/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0184 - accuracy: 0.9934 - val_loss: 1.3214 - val_accuracy: 0.9024\n",
            "Epoch 287/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0238 - accuracy: 0.9927 - val_loss: 1.3879 - val_accuracy: 0.8951\n",
            "Epoch 288/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0250 - accuracy: 0.9919 - val_loss: 1.2590 - val_accuracy: 0.9005\n",
            "Epoch 289/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0237 - accuracy: 0.9924 - val_loss: 1.3931 - val_accuracy: 0.9024\n",
            "Epoch 290/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0266 - accuracy: 0.9915 - val_loss: 1.3024 - val_accuracy: 0.9042\n",
            "Epoch 291/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0261 - accuracy: 0.9924 - val_loss: 1.3461 - val_accuracy: 0.8987\n",
            "Epoch 292/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0263 - accuracy: 0.9930 - val_loss: 1.3064 - val_accuracy: 0.9005\n",
            "Epoch 293/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0210 - accuracy: 0.9929 - val_loss: 1.2592 - val_accuracy: 0.9042\n",
            "Epoch 294/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0274 - accuracy: 0.9933 - val_loss: 1.2838 - val_accuracy: 0.8969\n",
            "Epoch 295/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0279 - accuracy: 0.9910 - val_loss: 1.2152 - val_accuracy: 0.8969\n",
            "Epoch 296/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0239 - accuracy: 0.9921 - val_loss: 1.3502 - val_accuracy: 0.8969\n",
            "Epoch 297/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0220 - accuracy: 0.9922 - val_loss: 1.3163 - val_accuracy: 0.9005\n",
            "Epoch 298/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0246 - accuracy: 0.9909 - val_loss: 1.3071 - val_accuracy: 0.9005\n",
            "Epoch 299/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0199 - accuracy: 0.9931 - val_loss: 1.2998 - val_accuracy: 0.9024\n",
            "Epoch 300/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0223 - accuracy: 0.9925 - val_loss: 1.2697 - val_accuracy: 0.8987\n",
            "Epoch 301/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0241 - accuracy: 0.9928 - val_loss: 1.3208 - val_accuracy: 0.9005\n",
            "Epoch 302/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0228 - accuracy: 0.9928 - val_loss: 1.3496 - val_accuracy: 0.8879\n",
            "Epoch 303/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0270 - accuracy: 0.9916 - val_loss: 1.2782 - val_accuracy: 0.8969\n",
            "Epoch 304/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0234 - accuracy: 0.9927 - val_loss: 1.3807 - val_accuracy: 0.8897\n",
            "Epoch 305/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0254 - accuracy: 0.9929 - val_loss: 1.2782 - val_accuracy: 0.8933\n",
            "Epoch 306/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0219 - accuracy: 0.9931 - val_loss: 1.3529 - val_accuracy: 0.8969\n",
            "Epoch 307/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0235 - accuracy: 0.9918 - val_loss: 1.3920 - val_accuracy: 0.8951\n",
            "Epoch 308/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0222 - accuracy: 0.9926 - val_loss: 1.3969 - val_accuracy: 0.8861\n",
            "Epoch 309/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0224 - accuracy: 0.9934 - val_loss: 1.2967 - val_accuracy: 0.9005\n",
            "Epoch 310/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0229 - accuracy: 0.9928 - val_loss: 1.3332 - val_accuracy: 0.8933\n",
            "Epoch 311/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0266 - accuracy: 0.9920 - val_loss: 1.3048 - val_accuracy: 0.8933\n",
            "Epoch 312/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0293 - accuracy: 0.9917 - val_loss: 1.3119 - val_accuracy: 0.8969\n",
            "Epoch 313/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0296 - accuracy: 0.9920 - val_loss: 1.3118 - val_accuracy: 0.9005\n",
            "Epoch 314/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0275 - accuracy: 0.9910 - val_loss: 1.2518 - val_accuracy: 0.9024\n",
            "Epoch 315/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0262 - accuracy: 0.9926 - val_loss: 1.1963 - val_accuracy: 0.9005\n",
            "Epoch 316/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0259 - accuracy: 0.9923 - val_loss: 1.2507 - val_accuracy: 0.8951\n",
            "Epoch 317/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0293 - accuracy: 0.9910 - val_loss: 1.2924 - val_accuracy: 0.8951\n",
            "Epoch 318/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0337 - accuracy: 0.9906 - val_loss: 1.2719 - val_accuracy: 0.8951\n",
            "Epoch 319/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0217 - accuracy: 0.9933 - val_loss: 1.3066 - val_accuracy: 0.8951\n",
            "Epoch 320/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0229 - accuracy: 0.9916 - val_loss: 1.2906 - val_accuracy: 0.8951\n",
            "Epoch 321/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0188 - accuracy: 0.9930 - val_loss: 1.3141 - val_accuracy: 0.8897\n",
            "Epoch 322/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0241 - accuracy: 0.9929 - val_loss: 1.2633 - val_accuracy: 0.8897\n",
            "Epoch 323/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0208 - accuracy: 0.9934 - val_loss: 1.2788 - val_accuracy: 0.8969\n",
            "Epoch 324/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0242 - accuracy: 0.9933 - val_loss: 1.3106 - val_accuracy: 0.8897\n",
            "Epoch 325/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0267 - accuracy: 0.9910 - val_loss: 1.3668 - val_accuracy: 0.8879\n",
            "Epoch 326/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0315 - accuracy: 0.9904 - val_loss: 1.3366 - val_accuracy: 0.8951\n",
            "Epoch 327/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0227 - accuracy: 0.9931 - val_loss: 1.3216 - val_accuracy: 0.8987\n",
            "Epoch 328/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0236 - accuracy: 0.9926 - val_loss: 1.2448 - val_accuracy: 0.9042\n",
            "Epoch 329/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0244 - accuracy: 0.9918 - val_loss: 1.3455 - val_accuracy: 0.8897\n",
            "Epoch 330/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0269 - accuracy: 0.9922 - val_loss: 1.3269 - val_accuracy: 0.8969\n",
            "Epoch 331/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0224 - accuracy: 0.9929 - val_loss: 1.2896 - val_accuracy: 0.9042\n",
            "Epoch 332/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0290 - accuracy: 0.9915 - val_loss: 1.2785 - val_accuracy: 0.8987\n",
            "Epoch 333/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0250 - accuracy: 0.9921 - val_loss: 1.3192 - val_accuracy: 0.9042\n",
            "Epoch 334/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0193 - accuracy: 0.9945 - val_loss: 1.3485 - val_accuracy: 0.9005\n",
            "Epoch 335/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0285 - accuracy: 0.9913 - val_loss: 1.3594 - val_accuracy: 0.8933\n",
            "Epoch 336/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0209 - accuracy: 0.9923 - val_loss: 1.3520 - val_accuracy: 0.8969\n",
            "Epoch 337/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0206 - accuracy: 0.9937 - val_loss: 1.2947 - val_accuracy: 0.8987\n",
            "Epoch 338/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0254 - accuracy: 0.9927 - val_loss: 1.3602 - val_accuracy: 0.9024\n",
            "Epoch 339/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0293 - accuracy: 0.9904 - val_loss: 1.3851 - val_accuracy: 0.8969\n",
            "Epoch 340/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0223 - accuracy: 0.9931 - val_loss: 1.3165 - val_accuracy: 0.9078\n",
            "Epoch 341/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0265 - accuracy: 0.9925 - val_loss: 1.3879 - val_accuracy: 0.8987\n",
            "Epoch 342/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0295 - accuracy: 0.9906 - val_loss: 1.2922 - val_accuracy: 0.8987\n",
            "Epoch 343/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0245 - accuracy: 0.9916 - val_loss: 1.3134 - val_accuracy: 0.9024\n",
            "Epoch 344/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0249 - accuracy: 0.9925 - val_loss: 1.3742 - val_accuracy: 0.8987\n",
            "Epoch 345/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0226 - accuracy: 0.9927 - val_loss: 1.3466 - val_accuracy: 0.9024\n",
            "Epoch 346/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0242 - accuracy: 0.9924 - val_loss: 1.4144 - val_accuracy: 0.8951\n",
            "Epoch 347/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0266 - accuracy: 0.9921 - val_loss: 1.3590 - val_accuracy: 0.9024\n",
            "Epoch 348/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0238 - accuracy: 0.9927 - val_loss: 1.3414 - val_accuracy: 0.9042\n",
            "Epoch 349/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0310 - accuracy: 0.9918 - val_loss: 1.3898 - val_accuracy: 0.9042\n",
            "Epoch 350/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0232 - accuracy: 0.9932 - val_loss: 1.3334 - val_accuracy: 0.9060\n",
            "Epoch 351/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0222 - accuracy: 0.9927 - val_loss: 1.3786 - val_accuracy: 0.9096\n",
            "Epoch 352/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0219 - accuracy: 0.9925 - val_loss: 1.3999 - val_accuracy: 0.9024\n",
            "Epoch 353/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0210 - accuracy: 0.9939 - val_loss: 1.4316 - val_accuracy: 0.8969\n",
            "Epoch 354/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0217 - accuracy: 0.9938 - val_loss: 1.4204 - val_accuracy: 0.8987\n",
            "Epoch 355/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0231 - accuracy: 0.9933 - val_loss: 1.4867 - val_accuracy: 0.8825\n",
            "Epoch 356/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0283 - accuracy: 0.9911 - val_loss: 1.3711 - val_accuracy: 0.9024\n",
            "Epoch 357/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0244 - accuracy: 0.9926 - val_loss: 1.4218 - val_accuracy: 0.8987\n",
            "Epoch 358/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0255 - accuracy: 0.9932 - val_loss: 1.3696 - val_accuracy: 0.8987\n",
            "Epoch 359/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0219 - accuracy: 0.9933 - val_loss: 1.3318 - val_accuracy: 0.9005\n",
            "Epoch 360/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0277 - accuracy: 0.9918 - val_loss: 1.4444 - val_accuracy: 0.9005\n",
            "Epoch 361/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0249 - accuracy: 0.9919 - val_loss: 1.3863 - val_accuracy: 0.9024\n",
            "Epoch 362/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0224 - accuracy: 0.9929 - val_loss: 1.4106 - val_accuracy: 0.9005\n",
            "Epoch 363/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0352 - accuracy: 0.9908 - val_loss: 1.4777 - val_accuracy: 0.9060\n",
            "Epoch 364/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0234 - accuracy: 0.9930 - val_loss: 1.3744 - val_accuracy: 0.9042\n",
            "Epoch 365/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0217 - accuracy: 0.9938 - val_loss: 1.3925 - val_accuracy: 0.9096\n",
            "Epoch 366/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0292 - accuracy: 0.9918 - val_loss: 1.3983 - val_accuracy: 0.9060\n",
            "Epoch 367/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0200 - accuracy: 0.9950 - val_loss: 1.3650 - val_accuracy: 0.9078\n",
            "Epoch 368/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0279 - accuracy: 0.9929 - val_loss: 1.4473 - val_accuracy: 0.9024\n",
            "Epoch 369/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0223 - accuracy: 0.9927 - val_loss: 1.4573 - val_accuracy: 0.9042\n",
            "Epoch 370/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0191 - accuracy: 0.9937 - val_loss: 1.5040 - val_accuracy: 0.8987\n",
            "Epoch 371/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0304 - accuracy: 0.9910 - val_loss: 1.5535 - val_accuracy: 0.8861\n",
            "Epoch 372/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0226 - accuracy: 0.9933 - val_loss: 1.3545 - val_accuracy: 0.8987\n",
            "Epoch 373/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0255 - accuracy: 0.9931 - val_loss: 1.2699 - val_accuracy: 0.9042\n",
            "Epoch 374/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0305 - accuracy: 0.9907 - val_loss: 1.4036 - val_accuracy: 0.9078\n",
            "Epoch 375/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0215 - accuracy: 0.9932 - val_loss: 1.2718 - val_accuracy: 0.9150\n",
            "Epoch 376/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0238 - accuracy: 0.9930 - val_loss: 1.3620 - val_accuracy: 0.9042\n",
            "Epoch 377/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0259 - accuracy: 0.9929 - val_loss: 1.3874 - val_accuracy: 0.9060\n",
            "Epoch 378/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0259 - accuracy: 0.9915 - val_loss: 1.4488 - val_accuracy: 0.9005\n",
            "Epoch 379/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0277 - accuracy: 0.9920 - val_loss: 1.3700 - val_accuracy: 0.9060\n",
            "Epoch 380/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0244 - accuracy: 0.9933 - val_loss: 1.3922 - val_accuracy: 0.9042\n",
            "Epoch 381/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0191 - accuracy: 0.9930 - val_loss: 1.4466 - val_accuracy: 0.8951\n",
            "Epoch 382/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0220 - accuracy: 0.9935 - val_loss: 1.4196 - val_accuracy: 0.9024\n",
            "Epoch 383/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0215 - accuracy: 0.9938 - val_loss: 1.3851 - val_accuracy: 0.9114\n",
            "Epoch 384/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0186 - accuracy: 0.9937 - val_loss: 1.4130 - val_accuracy: 0.9060\n",
            "Epoch 385/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0215 - accuracy: 0.9936 - val_loss: 1.4388 - val_accuracy: 0.9005\n",
            "Epoch 386/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0262 - accuracy: 0.9925 - val_loss: 1.4291 - val_accuracy: 0.9042\n",
            "Epoch 387/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0235 - accuracy: 0.9921 - val_loss: 1.3766 - val_accuracy: 0.9042\n",
            "Epoch 388/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0183 - accuracy: 0.9939 - val_loss: 1.3766 - val_accuracy: 0.9042\n",
            "Epoch 389/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0227 - accuracy: 0.9928 - val_loss: 1.3843 - val_accuracy: 0.9042\n",
            "Epoch 390/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0221 - accuracy: 0.9927 - val_loss: 1.3956 - val_accuracy: 0.9042\n",
            "Epoch 391/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0289 - accuracy: 0.9915 - val_loss: 1.3978 - val_accuracy: 0.9096\n",
            "Epoch 392/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0240 - accuracy: 0.9925 - val_loss: 1.4065 - val_accuracy: 0.9024\n",
            "Epoch 393/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0190 - accuracy: 0.9950 - val_loss: 1.3303 - val_accuracy: 0.9005\n",
            "Epoch 394/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0230 - accuracy: 0.9937 - val_loss: 1.3973 - val_accuracy: 0.9024\n",
            "Epoch 395/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0307 - accuracy: 0.9911 - val_loss: 1.3987 - val_accuracy: 0.9024\n",
            "Epoch 396/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0246 - accuracy: 0.9922 - val_loss: 1.5231 - val_accuracy: 0.8933\n",
            "Epoch 397/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0242 - accuracy: 0.9922 - val_loss: 1.4437 - val_accuracy: 0.9005\n",
            "Epoch 398/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0221 - accuracy: 0.9931 - val_loss: 1.4967 - val_accuracy: 0.8915\n",
            "Epoch 399/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0218 - accuracy: 0.9924 - val_loss: 1.4779 - val_accuracy: 0.8951\n",
            "Epoch 400/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0245 - accuracy: 0.9936 - val_loss: 1.4363 - val_accuracy: 0.9060\n",
            "Epoch 401/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0208 - accuracy: 0.9944 - val_loss: 1.4625 - val_accuracy: 0.9005\n",
            "Epoch 402/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0228 - accuracy: 0.9927 - val_loss: 1.6244 - val_accuracy: 0.8897\n",
            "Epoch 403/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0260 - accuracy: 0.9924 - val_loss: 1.3626 - val_accuracy: 0.9024\n",
            "Epoch 404/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0204 - accuracy: 0.9933 - val_loss: 1.4114 - val_accuracy: 0.9005\n",
            "Epoch 405/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0274 - accuracy: 0.9918 - val_loss: 1.3889 - val_accuracy: 0.9096\n",
            "Epoch 406/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0325 - accuracy: 0.9913 - val_loss: 1.6029 - val_accuracy: 0.8951\n",
            "Epoch 407/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0232 - accuracy: 0.9928 - val_loss: 1.4201 - val_accuracy: 0.9024\n",
            "Epoch 408/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0288 - accuracy: 0.9925 - val_loss: 1.3987 - val_accuracy: 0.9024\n",
            "Epoch 409/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0248 - accuracy: 0.9930 - val_loss: 1.4904 - val_accuracy: 0.8933\n",
            "Epoch 410/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0212 - accuracy: 0.9933 - val_loss: 1.4262 - val_accuracy: 0.9005\n",
            "Epoch 411/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0236 - accuracy: 0.9931 - val_loss: 1.4773 - val_accuracy: 0.9024\n",
            "Epoch 412/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0281 - accuracy: 0.9915 - val_loss: 1.4564 - val_accuracy: 0.9042\n",
            "Epoch 413/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0218 - accuracy: 0.9932 - val_loss: 1.5132 - val_accuracy: 0.9005\n",
            "Epoch 414/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0246 - accuracy: 0.9927 - val_loss: 1.4886 - val_accuracy: 0.9024\n",
            "Epoch 415/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0240 - accuracy: 0.9927 - val_loss: 1.4793 - val_accuracy: 0.9042\n",
            "Epoch 416/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0226 - accuracy: 0.9932 - val_loss: 1.4917 - val_accuracy: 0.8951\n",
            "Epoch 417/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0236 - accuracy: 0.9923 - val_loss: 1.3636 - val_accuracy: 0.9096\n",
            "Epoch 418/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0251 - accuracy: 0.9927 - val_loss: 1.4429 - val_accuracy: 0.9096\n",
            "Epoch 419/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0241 - accuracy: 0.9935 - val_loss: 1.4784 - val_accuracy: 0.9060\n",
            "Epoch 420/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0228 - accuracy: 0.9930 - val_loss: 1.4620 - val_accuracy: 0.9005\n",
            "Epoch 421/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0225 - accuracy: 0.9931 - val_loss: 1.3634 - val_accuracy: 0.9114\n",
            "Epoch 422/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0264 - accuracy: 0.9909 - val_loss: 1.5861 - val_accuracy: 0.8951\n",
            "Epoch 423/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0210 - accuracy: 0.9925 - val_loss: 1.4583 - val_accuracy: 0.9005\n",
            "Epoch 424/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0202 - accuracy: 0.9921 - val_loss: 1.5377 - val_accuracy: 0.8969\n",
            "Epoch 425/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0234 - accuracy: 0.9932 - val_loss: 1.3960 - val_accuracy: 0.9114\n",
            "Epoch 426/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0200 - accuracy: 0.9937 - val_loss: 1.4282 - val_accuracy: 0.9078\n",
            "Epoch 427/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0266 - accuracy: 0.9920 - val_loss: 1.5517 - val_accuracy: 0.8969\n",
            "Epoch 428/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0238 - accuracy: 0.9916 - val_loss: 1.3841 - val_accuracy: 0.9096\n",
            "Epoch 429/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0249 - accuracy: 0.9920 - val_loss: 1.4254 - val_accuracy: 0.9005\n",
            "Epoch 430/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0233 - accuracy: 0.9924 - val_loss: 1.5266 - val_accuracy: 0.8969\n",
            "Epoch 431/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0202 - accuracy: 0.9937 - val_loss: 1.4074 - val_accuracy: 0.9042\n",
            "Epoch 432/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0243 - accuracy: 0.9923 - val_loss: 1.5048 - val_accuracy: 0.9024\n",
            "Epoch 433/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0220 - accuracy: 0.9935 - val_loss: 1.3951 - val_accuracy: 0.9024\n",
            "Epoch 434/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0216 - accuracy: 0.9944 - val_loss: 1.4624 - val_accuracy: 0.9005\n",
            "Epoch 435/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0190 - accuracy: 0.9941 - val_loss: 1.5014 - val_accuracy: 0.8987\n",
            "Epoch 436/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0241 - accuracy: 0.9926 - val_loss: 1.4922 - val_accuracy: 0.8969\n",
            "Epoch 437/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0189 - accuracy: 0.9926 - val_loss: 1.4530 - val_accuracy: 0.9042\n",
            "Epoch 438/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0255 - accuracy: 0.9929 - val_loss: 1.4749 - val_accuracy: 0.9024\n",
            "Epoch 439/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0275 - accuracy: 0.9919 - val_loss: 1.4331 - val_accuracy: 0.9042\n",
            "Epoch 440/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0245 - accuracy: 0.9925 - val_loss: 1.5568 - val_accuracy: 0.8915\n",
            "Epoch 441/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0227 - accuracy: 0.9929 - val_loss: 1.4125 - val_accuracy: 0.9078\n",
            "Epoch 442/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0292 - accuracy: 0.9931 - val_loss: 1.4475 - val_accuracy: 0.9024\n",
            "Epoch 443/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0240 - accuracy: 0.9927 - val_loss: 1.4692 - val_accuracy: 0.8987\n",
            "Epoch 444/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0200 - accuracy: 0.9944 - val_loss: 1.3968 - val_accuracy: 0.9078\n",
            "Epoch 445/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0230 - accuracy: 0.9929 - val_loss: 1.4288 - val_accuracy: 0.8969\n",
            "Epoch 446/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0183 - accuracy: 0.9947 - val_loss: 1.5385 - val_accuracy: 0.8933\n",
            "Epoch 447/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0246 - accuracy: 0.9921 - val_loss: 1.4879 - val_accuracy: 0.9024\n",
            "Epoch 448/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0221 - accuracy: 0.9929 - val_loss: 1.4234 - val_accuracy: 0.9096\n",
            "Epoch 449/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0257 - accuracy: 0.9918 - val_loss: 1.4564 - val_accuracy: 0.9078\n",
            "Epoch 450/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0181 - accuracy: 0.9938 - val_loss: 1.3707 - val_accuracy: 0.9005\n",
            "Epoch 451/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0280 - accuracy: 0.9917 - val_loss: 1.4918 - val_accuracy: 0.9060\n",
            "Epoch 452/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0190 - accuracy: 0.9949 - val_loss: 1.4946 - val_accuracy: 0.9042\n",
            "Epoch 453/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0231 - accuracy: 0.9921 - val_loss: 1.4925 - val_accuracy: 0.9078\n",
            "Epoch 454/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0214 - accuracy: 0.9931 - val_loss: 1.5194 - val_accuracy: 0.9024\n",
            "Epoch 455/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0165 - accuracy: 0.9941 - val_loss: 1.4687 - val_accuracy: 0.9042\n",
            "Epoch 456/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0169 - accuracy: 0.9937 - val_loss: 1.5992 - val_accuracy: 0.9042\n",
            "Epoch 457/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0236 - accuracy: 0.9921 - val_loss: 1.4340 - val_accuracy: 0.9060\n",
            "Epoch 458/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0283 - accuracy: 0.9918 - val_loss: 1.6354 - val_accuracy: 0.9078\n",
            "Epoch 459/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0201 - accuracy: 0.9932 - val_loss: 1.5800 - val_accuracy: 0.8987\n",
            "Epoch 460/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0182 - accuracy: 0.9938 - val_loss: 1.4696 - val_accuracy: 0.9060\n",
            "Epoch 461/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0223 - accuracy: 0.9937 - val_loss: 1.5399 - val_accuracy: 0.9005\n",
            "Epoch 462/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0259 - accuracy: 0.9908 - val_loss: 1.5012 - val_accuracy: 0.9060\n",
            "Epoch 463/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0226 - accuracy: 0.9925 - val_loss: 1.5691 - val_accuracy: 0.8969\n",
            "Epoch 464/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0264 - accuracy: 0.9924 - val_loss: 1.5174 - val_accuracy: 0.9042\n",
            "Epoch 465/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0216 - accuracy: 0.9937 - val_loss: 1.5153 - val_accuracy: 0.8987\n",
            "Epoch 466/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0273 - accuracy: 0.9926 - val_loss: 1.5364 - val_accuracy: 0.9078\n",
            "Epoch 467/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0298 - accuracy: 0.9923 - val_loss: 1.4712 - val_accuracy: 0.9060\n",
            "Epoch 468/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0198 - accuracy: 0.9946 - val_loss: 1.5293 - val_accuracy: 0.9042\n",
            "Epoch 469/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0257 - accuracy: 0.9922 - val_loss: 1.5391 - val_accuracy: 0.9078\n",
            "Epoch 470/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0233 - accuracy: 0.9921 - val_loss: 1.5442 - val_accuracy: 0.9024\n",
            "Epoch 471/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0214 - accuracy: 0.9932 - val_loss: 1.5260 - val_accuracy: 0.8987\n",
            "Epoch 472/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0206 - accuracy: 0.9938 - val_loss: 1.5646 - val_accuracy: 0.8897\n",
            "Epoch 473/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0198 - accuracy: 0.9941 - val_loss: 1.4886 - val_accuracy: 0.8951\n",
            "Epoch 474/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0159 - accuracy: 0.9951 - val_loss: 1.5285 - val_accuracy: 0.8987\n",
            "Epoch 475/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0237 - accuracy: 0.9931 - val_loss: 1.5211 - val_accuracy: 0.9024\n",
            "Epoch 476/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0260 - accuracy: 0.9910 - val_loss: 1.5062 - val_accuracy: 0.9024\n",
            "Epoch 477/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0292 - accuracy: 0.9922 - val_loss: 1.5160 - val_accuracy: 0.9024\n",
            "Epoch 478/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0177 - accuracy: 0.9939 - val_loss: 1.5016 - val_accuracy: 0.9060\n",
            "Epoch 479/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0178 - accuracy: 0.9947 - val_loss: 1.4849 - val_accuracy: 0.9078\n",
            "Epoch 480/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0214 - accuracy: 0.9941 - val_loss: 1.5562 - val_accuracy: 0.9060\n",
            "Epoch 481/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0172 - accuracy: 0.9945 - val_loss: 1.5368 - val_accuracy: 0.9078\n",
            "Epoch 482/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0231 - accuracy: 0.9922 - val_loss: 1.5331 - val_accuracy: 0.9096\n",
            "Epoch 483/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0228 - accuracy: 0.9925 - val_loss: 1.5419 - val_accuracy: 0.9005\n",
            "Epoch 484/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0235 - accuracy: 0.9931 - val_loss: 1.5813 - val_accuracy: 0.8987\n",
            "Epoch 485/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0186 - accuracy: 0.9943 - val_loss: 1.5826 - val_accuracy: 0.9042\n",
            "Epoch 486/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0217 - accuracy: 0.9935 - val_loss: 1.4949 - val_accuracy: 0.9096\n",
            "Epoch 487/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0162 - accuracy: 0.9943 - val_loss: 1.5814 - val_accuracy: 0.9024\n",
            "Epoch 488/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0203 - accuracy: 0.9932 - val_loss: 1.4671 - val_accuracy: 0.9060\n",
            "Epoch 489/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0291 - accuracy: 0.9927 - val_loss: 1.5418 - val_accuracy: 0.8987\n",
            "Epoch 490/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0208 - accuracy: 0.9931 - val_loss: 1.5604 - val_accuracy: 0.9024\n",
            "Epoch 491/500\n",
            "34/34 [==============================] - 1s 25ms/step - loss: 0.0215 - accuracy: 0.9927 - val_loss: 1.5914 - val_accuracy: 0.9005\n",
            "Epoch 492/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0206 - accuracy: 0.9940 - val_loss: 1.6080 - val_accuracy: 0.8987\n",
            "Epoch 493/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0203 - accuracy: 0.9937 - val_loss: 1.4841 - val_accuracy: 0.9114\n",
            "Epoch 494/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0251 - accuracy: 0.9925 - val_loss: 1.5289 - val_accuracy: 0.8969\n",
            "Epoch 495/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0200 - accuracy: 0.9940 - val_loss: 1.5644 - val_accuracy: 0.8915\n",
            "Epoch 496/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0241 - accuracy: 0.9930 - val_loss: 1.5720 - val_accuracy: 0.9005\n",
            "Epoch 497/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0209 - accuracy: 0.9933 - val_loss: 1.7502 - val_accuracy: 0.8879\n",
            "Epoch 498/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0247 - accuracy: 0.9923 - val_loss: 1.5394 - val_accuracy: 0.8969\n",
            "Epoch 499/500\n",
            "34/34 [==============================] - 1s 23ms/step - loss: 0.0212 - accuracy: 0.9935 - val_loss: 1.5872 - val_accuracy: 0.9005\n",
            "Epoch 500/500\n",
            "34/34 [==============================] - 1s 24ms/step - loss: 0.0209 - accuracy: 0.9933 - val_loss: 1.5621 - val_accuracy: 0.9005\n",
            "9/9 [==============================] - 0s 5ms/step - loss: 1.5992 - accuracy: 0.8854\n",
            "[1.5992308855056763, 0.8854166865348816]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 17
        },
        "id": "OYQliRFJDEWg",
        "outputId": "2e4e020b-da1e-4574-eec5-850d60697e42"
      },
      "source": [
        "files.download('new_weights.h5') "
      ],
      "execution_count": 21,
      "outputs": [
        {
          "output_type": "display_data",
          "data": {
            "application/javascript": [
              "\n",
              "    async function download(id, filename, size) {\n",
              "      if (!google.colab.kernel.accessAllowed) {\n",
              "        return;\n",
              "      }\n",
              "      const div = document.createElement('div');\n",
              "      const label = document.createElement('label');\n",
              "      label.textContent = `Downloading \"${filename}\": `;\n",
              "      div.appendChild(label);\n",
              "      const progress = document.createElement('progress');\n",
              "      progress.max = size;\n",
              "      div.appendChild(progress);\n",
              "      document.body.appendChild(div);\n",
              "\n",
              "      const buffers = [];\n",
              "      let downloaded = 0;\n",
              "\n",
              "      const channel = await google.colab.kernel.comms.open(id);\n",
              "      // Send a message to notify the kernel that we're ready.\n",
              "      channel.send({})\n",
              "\n",
              "      for await (const message of channel.messages) {\n",
              "        // Send a message to notify the kernel that we're ready.\n",
              "        channel.send({})\n",
              "        if (message.buffers) {\n",
              "          for (const buffer of message.buffers) {\n",
              "            buffers.push(buffer);\n",
              "            downloaded += buffer.byteLength;\n",
              "            progress.value = downloaded;\n",
              "          }\n",
              "        }\n",
              "      }\n",
              "      const blob = new Blob(buffers, {type: 'application/binary'});\n",
              "      const a = document.createElement('a');\n",
              "      a.href = window.URL.createObjectURL(blob);\n",
              "      a.download = filename;\n",
              "      div.appendChild(a);\n",
              "      a.click();\n",
              "      div.remove();\n",
              "    }\n",
              "  "
            ],
            "text/plain": [
              "<IPython.core.display.Javascript object>"
            ]
          },
          "metadata": {
            "tags": []
          }
        },
        {
          "output_type": "display_data",
          "data": {
            "application/javascript": [
              "download(\"download_bd8771ef-6caf-4fb2-b2e7-97a111699dfe\", \"new_weights.h5\", 1757520)"
            ],
            "text/plain": [
              "<IPython.core.display.Javascript object>"
            ]
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    }
  ]
}